package com.lagou.task09;

public class SubAbstractTest extends AbstractTest {
    @Override
    public void show() {
        System.out.println("我是被迫重写的, 否则我也要变成抽象类");
    }

    public static void main(String[] args) {
        //声明本类类型引用指向本类对象
        SubAbstractTest sat = new SubAbstractTest();
        sat.show();
        System.out.println("---------");

        //声明AbstractTest类型的引用指向子类对象, 多态使用场景之二
        AbstractTest at = new SubAbstractTest2();
        //编译阶段, 调用父类类型的引用, 运行阶段, 调用子类类型的引用
        at.show();
        //at.test();
        ((SubAbstractTest2) at).test();

        System.out.println("---------");
        SubAbstractTest2 sat2 = new SubAbstractTest2();
        sat2.test();
    }
}
